#include "GMGetPlayerTurn.h"
#include "GameMessageFactory.h"
#include <iostream>

const char* GMGetPlayerTurn::m_NAME = "GetPlayerTurn"; 
static bool registered = TheGameMessageFactory::Instance()->AddObject(GMGetPlayerTurn::m_NAME, GMGetPlayerTurn::Create);

GMGetPlayerTurn::GMGetPlayerTurn()
{
	//m_NAME = "GetPlayerTurn";	
}

GMGetPlayerTurn::~GMGetPlayerTurn()
{}

void GMGetPlayerTurn::Execute()
{
	std::cout<<m_Msg;

	std::getline(std::cin,m_Msg);

	//send message to server
	//server broadcast

}

bool GMGetPlayerTurn::ReadFromSocketM(SockMessage* sm)
{
	std::cout<<"Reading message: "<<m_NAME<<"\n";
	sm->ReadString(&m_Msg);
	return true;
}
bool GMGetPlayerTurn::WriteToSocketM(SockMessage* sm)
{

	m_Msg="It's your turn!\n";
	std::cout<< "Writing message: "<<m_NAME <<"\n";
	sm->WriteString(m_Msg);
	return true;
}

GameMessage* GMGetPlayerTurn::Create()
{
	return new GMGetPlayerTurn;
}